# 冒泡排序

shuzi=[1,76,45,87,34,2,4]
for i in range(0,len(shuzi)-1):
    for j in range(0,len(shuzi)-1-i):
        if shuzi[j]>shuzi[j+1]:
            shuzi[j],shuzi[j+1]=shuzi[j+1],shuzi[j]
print(shuzi)

#
# shuzi=[3,6,4,7657,23432,87,3545,978,345,564,234]
# for i in range(0,len(shuzi)-1):
#     for j in range(0,len(shuzi)-1-i):
#         if shuzi[j]>shuzi[j+1]:
#             shuzi[j],shuzi[j+1]=shuzi[j+1],shuzi[j]
# print(shuzi)

# shuzi = [435, 324, 6766, 45234, 457, 234, 876]
# for i in range(0, len(shuzi) - 1):
#     for j in range(0, len(shuzi) - 1):
#         if shuzi[j] > shuzi[j + 1]:
#             shuzi[j], shuzi[j + 1] = shuzi[j + 1], shuzi[j]
# print(shuzi)

# shuzi=[34,65,87,98,35,67,23,89,67876,34534,23423,56758,3546546,96869,7476]#长度为7--len(shuzi)
# for i in range(0,len(shuzi)-1):#i代表轮数的下标  第一轮下标为0   比较len()-1
#     for j in range(0,len(shuzi)-1-i):
#         if shuzi[j]>shuzi[j+1]:#比较相邻两个元素的大小
#             shuzi[j],shuzi[j+1]=shuzi[j+1],shuzi[j]#重新赋值---两个数调换位置
# print(shuzi)